function validate(){
	var status = true;	
	var showExplanRequired	= false;	
	var RequiredCount		= 0;
	
	$("textarea[validate],input[validate],select[validate]").css({border:"1px solid #BDC7D8"});
	$("#_clazz").css({border:"0px solid #FFFFFF"});
	$("#_ofiles").css({border:"0px solid #FFFFFF"});
	$("#AgricultureAndFoodForm input[name=url]").css({border:"1px solid #BDC7D8"});
	
	$("textarea[validate],input[validate]").each(function(data){
		var validateRule = ($(this).attr("validate"));	
		
		if(validateRule.indexOf("required") != -1){
			if(trim(this.value).length == 0){
				$(this).css({border:"3px dotted #FF0000"});
				showExplanRequired = true;
				RequiredCount++;
				status = false;
				return true;
			}			
		}	
	});

	$("select[validate]").each(function(data){
		var validateRule = ($(this).attr("validate"));	
		
		if(validateRule.indexOf("required") != -1){
			if(this.value == 0){
				$(this).css({border:"3px dotted #FF0000"});
				showExplanRequired = true;
				RequiredCount++;	
				status = false;
				return true;
			}			
		}
	});
	
	/************* 例外處理1 ****************************/
	var clazzcnt = 0;
	$('.clazz').each(function(){		
		if($(this).prop("checked") == true)
			clazzcnt++;		
	});
	if(clazzcnt == 0){
		$("#_clazz").css({border:"3px dotted #FF0000"});
		showExplanRequired = true;
		RequiredCount++;
		status = false;
	}	
	/***************************************************/
	
	//alert($('#files').val().length);
	/************* 例外處理2 ****************************/	
	
	var _isUrl = trim($("#AgricultureAndFoodForm input[name=url]").val()).length == 0;
	var _isFiles = $('#files').val().length <= 1;
	
	
	if(_isUrl && _isFiles){
		$("#_ofiles").css({border:"3px dotted blue"});
		$("#AgricultureAndFoodForm input[name=url]").css({border:"3px dotted blue"});
		showExplanRequired = true;
		RequiredCount++;
		status = false;
	}	
	/***************************************************/
	
	
	if(!status){
		$(".errorHintTbody").hide();
		var _sum = 0;
		if(showExplanRequired){
			_sum++;
			//$("#tRequired").show();
			//$("#spRequired").html("(" +  RequiredCount +")");
			//alert(RequiredCount);
		}	
	}
	
	
	return status;
}